from data import *
from fisher import *

accuracy = 0

for i in range(100):
    classes = generate_two_classes(radius=40)
    # visualize_two_classes(classes)

    class1, class2 = classes
    x1 = class1[:80][:]
    x2 = class2[:80][:]
    test1 = class1[80:][:]
    test2 = class2[80:][:]

    for x_test1 in test1:
        if fisher(x1, x2, x_test1):
            accuracy += 1

    for x_test2 in test2:
        if not fisher(x1, x2, x_test2):
            accuracy += 1

print("测试100次平均准确率", accuracy / 4000)